import {
    axiosGet,
    axiosPost
} from "./index.js"

// 取得首页数据
function getIndexInfo() {
    let url = "/goods/getIndexInfo"
    return new Promise(function (resolve) {
        resolve(axiosGet(url))
    })
}

// 获取详情页信息
function getDetailGoodsInfo(id) {
    let url = "/goods/getDetailGoodsInfo"
    let params={
        goodsId:id
    }
    return new Promise(function (resolve) {
        resolve(axiosPost(url,params))
    })
}

//**读取大类数据的接口 */
function getCategoryList() {
    let url = "/goods/getCategoryList"
    return new Promise(function (resolve) {
        resolve(axiosGet(url))
    })
}

/**读取小类的数据 */
function getCategorySubList(id) {
    let url = "/goods/getCategorySubList"
    let params={
        categoryId:id
    }
    return new Promise(function (resolve) {
        resolve(axiosPost(url,params))
    })
}

/**根据类别获取商品列表 */
function getGoodsList(id) {
    let url = "/goods/getGoodsListByCategorySubID"
    let params = {
        categorySubId:id
    }
    return new Promise(function (resolve) {
        resolve(axiosPost(url,params))
    })
}
export {
    getIndexInfo,
    getCategoryList,
    getCategorySubList,
    getGoodsList,
    getDetailGoodsInfo
}